package com.iweb.Start;

import com.iweb.manager.Master;

import java.util.Scanner;

public class Game {
    Scanner scanner = new Scanner(System.in);
    public void menu() {
        Master master = new Master();
        System.out.println("******欢迎登录宠物游戏******");
        System.out.println("正在初始化数据......");
        master.initData();   //调用主人类中初始数据方法
        System.out.println("初始化数据成功");
        master.displayPets();   //显示初始宠物

        int a = 0;
        do {
            System.out.println("1.领养宠物");
            System.out.println("2.喂养宠物");
            System.out.println("3.升级宠物");
            System.out.println("4.显示宠物");
            System.out.println("5.扩展格子");
            System.out.println("6.充值");
            System.out.println("请选择菜单:");
            int m = scanner.nextInt();
            switch (m) {         //根据所输入序号，调用主人类相应的方法
                case 1:
                    master.getNewPet();
                    break;
                case 2:
                    master.feedPet();
                    break;
                case 3:
                    master.upLevelPet();
                    break;
                case 4:
                    master.displayPets();
                    break;
                case 5:
                    master.addPetGrid();
                    break;
                case 6:
                    master.recharge();
                    break;
                default:
                    break;
            }
            System.out.println("输入0返回菜单，输入任意数字退出");
             a = scanner.nextInt();
        }while(a==0);    //当输入0循环输出菜单，当输入不为0则退出
    }

    public static void main(String[] args) {
        new Game().menu();
    }
}



